<template>
  <smart-page >

    <template #search>
      <smart-search :query-array="RECORD_SEARCH" @on-handler="onSearch"/>
    </template>
    <a-table v-model:selectedKeys="selectedKeys"
             :table-layout-fixed="theme.layoutFixed"
             :row-selection="rowSelection"
             :columns="RECORD_COLUMNS"
             :row-key="rowKey"
             :column-resizable="theme.resizable"
             :bordered="theme.bordered"
             :stripe="theme.stripe"
             :sticky-header="theme.sticky"
             :hoverable="theme.hoverAble"
             :pagination="pagination"
             :loading="theme.loading"
             :data="dataSource"
             @page-change="onPageChange"
             @page-size-change="onPageSizeChange" />



  </smart-page>
</template>
<script lang="ts" setup name="system-schedule-record">
import {onMounted} from 'vue';
import {Acl} from "@/libs/acl";
import {RECORD_SEARCH} from '../resource/search'
import {RECORD_COLUMNS} from "../resource/colums";
import {TablePage} from "@/libs/core";
import {SystemHttp} from "../resource/http";
import router from "@/libs/router";


const pageConfig = {title: '执行记录', rowKey: 'id', nameKey: 'name'}
const {getScheduleRecordPage} = SystemHttp
const tablePage = new TablePage(pageConfig).setFetchXhr(getScheduleRecordPage).setPermission(Acl.SYSTEM_SCHEDULE_RECORD_PAGE_LIST);

const {theme, pagination, rowKey, dataSource, rowSelection, selectedKeys, editCtr} = tablePage
const {onFetch, onPageChange, onPageSizeChange, onDelete, onSearch} = tablePage
onMounted(() =>{
  const {query} = router.currentRoute.value
  if (query?.taskId !== undefined) tablePage.searchData.value.taskId = query.taskId
  onFetch()
} )

</script>

